<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    .father {
      width: 200px;
      height: 200px;
      background-color: pink;
      /* 1. 给父盒子添加padding-top 解决塌陷 */
      /* padding-top: 20px; */
      /* 2. overflow: hidden; 解决方案 */
      /* overflow: hidden; */
      /* 3. 加上边框解决 */
      /* border-top: 1px solid transparent; */
    }

    .son {
      width: 100px;
      height: 100px;
      background-color: blue;
      margin-top: 20px;
    }

    .w {
      width: 1226px;
      height: 500px;
      background-color: pink;
      /* 有宽度的块级元素 左右外边距设置为 auto */
      margin: 0 auto;
    }
  </style>
</head>

<body>
  <div class="father">
    <div class="son"></div>
  </div>


  <div class="w">版心</div>
</body>

</html>